<?php

namespace Packages\Image\Http\Controllers\Client;

use Illuminate\Http\Request;
use App\Http\Controllers\Controller;
use Packages\Image\Services\ImageService;

class ImageController extends Controller
{
    protected ImageService $imageService;

    public function __construct(ImageService $imageService)
    {
        $this->imageService = $imageService;
    }

    /**
     * 图片对比
     *
     * @return string
     * @throws \Exception
     */
    public function imgDistance(Request $request)
    {
        $params = $this->validateParams($request, [
            'img1' => 'required|string',
            'img2' => 'required|string',
        ]);

        return $this->imageService->imgDistance($params['img1'], $params['img2']);
    }
}
